package org.huzhp.security.wx;


import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * @Description: 微信登录集成类
 * @Author: huzp
 * @CreateDate: 2019/8/31 9:39
 * @Version: 1.0
 */
@ConfigurationProperties(prefix = "wxlogin")
public class WxAuthProperties {

    private static final String WX_TOKEN_URL = "/sns/oauth2/access_token?appid=APPID&secret=SECRET&code=CODE&grant_type=authorization_code";
    private static final String WX_API_USER_URL = "/sns/userinfo?access_token=ACCESS_TOKEN&openid=OPENID&lang=zh_CN";

    private boolean enable;

    private String server;

    private String host;

    private String openId;

    private String openSecret;

    private String redirectUrl;

    private String accessTokenUri;

    private String userInfoUri;

    private String bindUrl;

    public boolean isEnable() {
        return enable;
    }

    public void setEnable(boolean enable) {
        this.enable = enable;
    }

    public String getServer() {
        return server;
    }

    public void setServer(String server) {
        this.server = server;
        this.accessTokenUri = server + WX_TOKEN_URL;
        this.userInfoUri = server + WX_API_USER_URL;
    }

    public String getHost() {
        return host;
    }

    public void setHost(String host) {
        this.host = host;
        this.redirectUrl = host + "/wxLogin";
        this.bindUrl = host + "/oauth/wxBind";
    }

    public String getOpenId() {
        return openId;
    }

    public void setOpenId(String openId) {
        this.openId = openId;
    }

    public String getOpenSecret() {
        return openSecret;
    }

    public void setOpenSecret(String openSecret) {
        this.openSecret = openSecret;
    }


    public String getRedirectUrl() {
        return redirectUrl;
    }

    public String getBindUrl() {
        return bindUrl;
    }

    public String getAccessTokenUri() {
        return accessTokenUri;
    }

    public String getUserInfoUri() {
        return userInfoUri;
    }
}
